{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "blank-hardware",
   "metadata": {},
   "source": [
    "# LASSO"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "convinced-qatar",
   "metadata": {},
   "outputs": [],
   "source": [
    "##keep\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "synthetic-kenya",
   "metadata": {},
   "source": [
    "## 生成数据集"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "abroad-continent",
   "metadata": {},
   "outputs": [],
   "source": [
    "##keep\n",
    "from sklearn.datasets import make_regression\n",
    "data, target = make_regression(n_samples = 200, n_features = 500, n_informative = 5, noise = 5)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "martial-roulette",
   "metadata": {},
   "source": [
    "## 用LASSO来适配"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "selected-recording",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "id": "religious-slide",
   "metadata": {},
   "source": [
    "## 计算模型中非零的系数的个数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "vulnerable-contract",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "id": "handed-quest",
   "metadata": {},
   "source": [
    "## alpha为零时的非零系数个数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "direct-plane",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "id": "endless-merchant",
   "metadata": {},
   "source": [
    "## 找出最佳alpha参数值\n",
    "使用LassoCV来找。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "electronic-outreach",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "id": "ad170d70",
   "metadata": {},
   "source": [
    "打印最佳alpha参数。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "educated-memorabilia",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "id": "apparent-greensboro",
   "metadata": {},
   "source": [
    "## 找出最佳匹配中非零系数的个数\n",
    "先打印出总的系数个数。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "laughing-concord",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "id": "cfe15611",
   "metadata": {},
   "source": [
    "再打印出非零系数的个数。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "impossible-vocabulary",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "id": "electrical-remark",
   "metadata": {},
   "source": [
    "## 用LASSO作特征选择\n",
    "选出系数不为零的列。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "answering-vinyl",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.7"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
